package com.project.bean;

import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.time.LocalDate;

/**
 * 用户实体类
 */public class UserBean {
    /**编号*/
    private Integer id;
    /**用户名*/
    @NotBlank(message = "用户名必须填写")
    @Length(min = 2,max = 10,message = "用户名长度在2-10之间")
    private String name;
    /**电话*/
    @NotBlank(message = "电话必须填写")
    @Pattern(regexp = "1[35789]\\d{9}",
            message = "电话必须是13、15、17、18、19开始的11位数")
    private String phone;
    /**工资*/
    @NotNull(message = "工资必须填写")
    @Max(value = 20000,message = "工资那么高，老板不亏呀")
    @Min(value = 1800,message = "工资那么低，还让不让人活")
    private Integer money;
    /**生日*/
    @NotNull(message = "生日必须填写")
    private LocalDate birthday;


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Integer getMoney() {
        return money;
    }

    public void setMoney(Integer money) {
        this.money = money;
    }

    public LocalDate getBirthday() {
        return birthday;
    }

    public void setBirthday(LocalDate birthday) {
        this.birthday = birthday;
    }

    @Override
    public String toString() {
        return "UserBean{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", phone='" + phone + '\'' +
                ", money=" + money +
                ", birthday=" + birthday +
                '}';
    }
}
